package com.jh.paymentchannel.pojo.enums;

import org.apache.commons.lang3.StringUtils;

/**
 * 通道枚举
 */
public enum ChannelTag {

    CHANPAYNEWCARD_04("CHANPAYNEWCARD_04", "代还商旅05"),

    CHANPAYNEWCARD_0101("CHANPAYNEWCARD_0101", "畅捷新无卡101"),

    CHANPAYNEWCARD_0102("CHANPAYNEWCARD_0102", "畅捷新无卡102"),
    CHANPAYNEWCARD2_04("CHANPAYNEWCARD2_04", "快捷商旅05"),
    ;

    final String value;
    final String desc;

    ChannelTag(String value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    public String getValue() {
        return value;
    }

    public String getDesc() {
        return desc;
    }

    public static <T extends String> String of(T n) {
        String val;
        if (StringUtils.isEmpty(n)) {
            return null;
        }
        val = n;
        for (ChannelTag channelTag: values()) {
            if (channelTag.getValue().equals(val))
                return channelTag.getDesc();
        }
        return null;
    }
}
